
$(function(){
// var id = 1300;
setInterval(getTr(),10000);

});
function getTr(){
  
var nowId = $('#nowId').val();
    var start_time = $('#datemin').val();
    var end_time = $('#datemax').val();
    var community_id =$("#community_id option:selected").val();
    var status =$("#status option:selected").val();
    var key = $('#search').val();
    var regtime = $('#regtime').val();
// var id = '2016-06-15 12:27:59';
           $.ajax({
        url: "http://qtcrm.cc/index.php?m=Admin&c=WechatUser&a=roll",
        type: "POST",
        data:{
        start_time:start_time,
        end_time:end_time,
        community_id:community_id,
        status:status,
        key:key,
        regtime:regtime
        },

        error: function () {

        },
        success: function (data, status) { 
            console.log(data);
            if (data.status == false) {
               
            } else {
                
                for (var i = 0; i < data.data.length; i++) {

                var str = "<tr  class='text-c'>";
                 str += "<td>"+data.data[i].id+"</td>";
                 str += "<td>"+data.data[i].community_name+"</td>";
                 str += "<td>"+data.data[i].user.name+"</td>";
                 str += "<td>"+data.data[i].tel+"</td>";
                 str += "<td>"+data.data[i].address+"</td>";
                 str += "<td>"+data.data[i].verify_time+"</td>";
                 str += "<td>"+data.data[i].regtime+"</td>";
                 str += "<td>"+data.data[i].wechaname+"</td>";
                 if(data.data[i].sex == 1){
                    str += "<td>男</td>";
                 }else{
                    str += "<td>女</td>";
                 }
                 str += "<td>"+data.data[i].status_title+"</td>";
                 if(data.data[i].status_title == '审核中'){
                    str += "<td><a href='/index.php?m=Admin&c=WechatUser&a=peopleVerify&id="+data.data[i].id+"&isverify=1' class='label label-success radius'>通过</a>";
                 str += "<a href='/index.php?m=Admin&c=WechatUser&a=peopleVerify&id="+data.data[i].id+"&isverify=-1' class='label label-primary radius'>不通过</a></td>"
                 }else{
                    str += "<td></td>";
                 
                 }
                 // if (data.data[i].step==1 || data.data[i].step==2) {
                 //    str += "<td width='100'><a href='javascript:to2("+"&#39;/index.php?m=Service&c=WxOrder&a=appoint&id="+data.data[i].id+"&#39;"+");' class='label label-secondary  radius'>人工指派</a>";
                 //    str += "<a href='javascript:to2("+"&#39;/index.php?m=Service&c=WxOrder&a=rob&id="+data.data[i].id+"&#39;"+");' class='label label-secondary  radius' onclick='return confirm("+"&#39;是否设为自助抢单&#39;"+")'>自助抢单</a>";
                 //    str += "<a href='javascript:to3("+"&#39;/index.php?m=Service&c=WxOrder&a=cancel&id="+data.data[i].id+"&#39;"+");' class='label label-secondary  radius'>取消订单</a>";
                 //    str += "<a href='javascript:to2("+"&#39;/index.php?m=Service&c=WxOrder&a=info&id="+data.data[i].id+"&#39;"+");' class='label label-secondary  radius'>查看详情</a></td>";

                 // }else if(data.data[i].step==3 || data.data[i].step==4 || data.data[i].step==5 || data.data[i].step==6 || data.data[i].step==7){
                 //    str += "<td width='100'><a class='label radius' style='cursor: not-allowed;'>人工指派</a>";
                 //    str += "<a class='label radius' style='cursor: not-allowed;'>自助抢单</a>";
                 //    str += "<a class='label radius' style='cursor: not-allowed;'>取消订单</a>";
                 //    str += "<a href='javascript:to2("+"&#39;/index.php?m=Service&c=WxOrder&a=info&id="+data.data[i].id+"&#39;"+");' class='label label-secondary  radius'>查看详情</a></td>";
                 // }
                    
                 str += "</tr>";

                
                
                $("#roll").after(str);
                $("#regtime").val(data.data[i].regtime);
                }
            }
            setTimeout(function() {
                getTr();
            }, 10000);
        }
    });
}

// function   formatDate(now)   {     
//               var   year=now.getYear();     
//               var   month=now.getMonth()+1;     
//               var   date=now.getDate();     
//               var   hour=now.getHours();     
//               var   minute=now.getMinutes();     
//               var   second=now.getSeconds();     
//               return   year+"-"+month+"-"+date+"   "+hour+":"+minute+":"+second;     
//               }     
         
//               var   d=new   Date(1230999938);     
//               alert(formatDate(d)); 




 

// var unix = data.data[i].regtime;
// var datetime = unix_to_datetime(unix);
// function unix_to_datetime(unix) {
//     var now = new Date(parseInt(unix) * 1000);
//     return now.toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
// }
 

 

